/*
*编写一个函数，返回其形参的绝对值
*/
#include <iostream>
using namespace std;

int getAbsValue(int);

int main()
{	
	int iVal;
	cout << "请输入一个整数：";
	cin >> iVal;
	cout << iVal << "的绝对值是  " << getAbsValue(iVal) << endl;

	system("pause");
	return 0;
}

int getAbsValue(int baseVal)
{
	int result;
	if(baseVal >= 0)
	{
		result = baseVal;
	}
	else
	{
		result = -(baseVal);
	}

	return result;
}